package com.heaboy.collection;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class liu {
    public static void main(String[] args) {
        String a="1";
        a.length();
        a.
        List<String> list=new ArrayList<>();
        list.add("你好");
        list.add("你好2");
        list.add("我好1");
        //先是过滤里面的长度为3的然后再遍历打印 filter过滤的写法
        list.stream().filter(s->s.startsWith("我")).filter(s->s.length()==3).forEach(s-> System.out.println(s));
        //stream可以通过集合数组创建 创建流
        List<String> list1= Arrays.asList("a","b","c");
        Stream<String> stream=list1.stream();
        System.out.println("分着的流"+stream);
        Stream<String> stream1=list1.parallelStream();
        System.out.println("合并的流"+stream1);
    }
}
